<?php

$zip = new ZipArchive();
$filename = "./test112.zip"; //zip名字和路径

//创建一个zip
if ($zip->open($filename, ZIPARCHIVE::CREATE)!==TRUE) {
    exit("cannot open <$filename>\n");
}

//模拟查询的数据
$imgs = ['身份证正面.jpg'=>'./upload1/a1.jpg','身份证反面.jpg'=>'./upload1/a2.jpg','行驶证.jpg'=>'./upload2/b1.jpg','驾驶证.jpg'=>'./upload2/b2.jpg'];

foreach ($imgs as $key => $value) {
	$zip->addFile($value, $key);
}
		
//关闭文件
$zip->close();